<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no">
	<title>供应商消息</title>
	<link rel="stylesheet" type="text/css" href="../css/supplierxiaoxi.css">
	<script type="text/javascript" src="../js/rem2.js"></script>
</head>
<body>
	<div class="wrap">
		<!-- 头部 -->
		<div class="header">
			<label class="header_left"><img src="../img/w_nav_back.png"></label>
			<div class="header_choose">
				<div class="choose_left"><a href="dailixiaoxi.html">代理商消息</a></div>
				<div class="choose_right"><a href="javascript:void(0)">供应商消息</a></div>
			</div>
		</div>
		<!-- 头部 -->
		<!-- 内容 -->
		<div class="content">
			<!-- <div class="item">
				<div class="item_left">
					<img src="../img/head_img.jpg">
				</div>
				<div class="item_right">
					<h4 class="name">MARUKO</h4>
					<h5 class="xiaoxi">恭喜你!成功成为本店的代理商!</h5>
				</div>
				<span class="time">18:52:16</span>
			</div>
			<div class="item">
				<div class="item_left">
					<img src="../img/head_img.jpg">
				</div>
				<div class="item_right">
					<h4 class="name">SUNDAY</h4>
					<h5 class="xiaoxi">恭喜你!成功成为本店的代理商!</h5>
				</div>
				<span class="time">12:22:35</span>
			</div>
			<div class="item">
				<div class="item_left">
					<img src="../img/head_img.jpg">
				</div>
				<div class="item_right">
					<h4 class="name">SUNDAY</h4>
					<h5 class="xiaoxi">恭喜你!成功成为本店的代理商!</h5>
				</div>
				<span class="time">12:22:35</span>
			</div>
			<div class="item">
				<div class="item_left">
					<img src="../img/head_img.jpg">
				</div>
				<div class="item_right">
					<h4 class="name">SUNDAY</h4>
					<h5 class="xiaoxi">恭喜你!成功成为本店的代理商!</h5>
				</div>
				<span class="time">12:22:35</span>
			</div> -->
		</div>
		<!-- 内容 -->
	</div>
</body>
<script type="text/javascript">
	var xhr = new XMLHttpRequest();
	xhr.addEventListener("readystatechange",function(e){
		if(xhr.status==200&&xhr.readyState==4){
			var Obj = JSON.parse(e.target.response).xiaoxi
			readData(Obj)
		}
	})
	xhr.open("GET","https://www.easy-mock.com/mock/5bacade73679ca0f56b03f93/gongyingxiaoxi")
	xhr.send()
	
	function readData(res){
		var content = document.querySelector(".content")
		var obj = res;
		var template = function(pic,name,text,time){
			return `
				<div class="item_left">
					<img src=${pic}>
				</div>
				<div class="item_right">
					<h4 class="name">${name}</h4>
					<h5 class="xiaoxi">${text}</h5>
				</div>
				<span class="time">${time}</span>
			`
		}
		obj.forEach(function(el,index){
			var item = document.createElement("div")
			item.classList.add("item")
			item.innerHTML=template(el.pic,el.name,el.text,el.time)
			content.appendChild(item)
		})
	}
</script>
</html>